package utilcollection;

import java.util.Comparator;
import java.util.TreeSet;

public class MyComp implements Comparator<String> {
    @Override
    public int compare(String aStr, String bStr){
        //eturn bStr.compareTo(aStr);
        return aStr.compareTo(bStr);
    }


}

class CompDemo{
    public static void main(String[] args) {
       // TreeSet<String> ts=new TreeSet<>(new MyComp());
        MyComp mc=new MyComp();

        TreeSet<String> ts=new TreeSet<>(mc.reversed());

        ts.add("C");
        ts.add("A");
        ts.add("B");
        ts.add("E");
        ts.add("F");
        ts.add("D");


        for (String element :ts) {
            System.out.println(element+ " ");

        }


    }
}
